﻿function writeLog(msg) {
    console.log(msg);
}

var timer;

function autoGo() {
    var time = new Date("2017-05-02 16:20:00");
    writeLog(time);
    if (timer == null) {
        var t = time - Date.now();
        writeLog(t);
        timer = setTimeout(function () {
            writeLog("执行点击事件");
            var obj = document.getElementsByClassName("btn-link-normal");
            writeLog(obj);
            if (obj != null && obj.length > 0) {
                writeLog("点击1");
                obj[0].click();
            }
            obj = document.getElementById("order-submit");
            writeLog(obj);
            if (obj != null) {
                writeLog("点击2");
                obj.click();
            }
        }, t);
    }
}

autoGo();